package cn.ad.service;

import cn.ad.entity.Platform;
import cn.ad.handler.SqlSessionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 平台业务实现类
 * @author shirongkang
 */
@Service
public class PlatformService {

	@Autowired
	private SqlSessionHandler sqlSessionHandler;
	
	public List<Platform> getPlatformList(String type) {
		return sqlSessionHandler.selectList("platformMapper.select:platform:list", type);
	}

	public List<Platform> getPlatformList(Integer strategy) {
		return sqlSessionHandler.selectList("platformMapper.select:platform:list:by:strategyId", strategy);
	}

	public List<Platform> getPlatformListByStrategyGroup(Integer strategyGroupId) {
		return sqlSessionHandler.selectList("platformMapper.select:platform:list:by:strategyGroupId", strategyGroupId);
	}

	/**
	 * 查询平台详细信息
	 */
	public Platform getPlatformById(Integer id) {
		return sqlSessionHandler.selectOne("platformMapper.selectById", id);
	}

	/**
	 * 查询有效的平台信息
	 */
	public Platform selectPlatformByIdAndStatus(Integer id) {
		return sqlSessionHandler.selectOne("platformMapper.selectByIdAndStatus", id);
	}

}
